package com.example.mvvmtest.viewModel

import androidx.lifecycle.ViewModel
import com.example.mvvmtest.Repository.UserRepository

open class UserViewModel(open val userRepository: UserRepository): ViewModel() {

    // 验证密码格式
    protected fun isPasswordValid(password: String): Boolean{
       val containsDigit = Regex("[0-9]").containsMatchIn(password)
       val containsLowerCase = Regex("[a-z]").containsMatchIn(password)
       val containsUpperCase = Regex("[A-Z]").containsMatchIn(password)
       return password.length >= 8 && containsDigit && containsLowerCase && containsUpperCase
    }


}